
package shiyan3;

import javax.swing.*;
import java.io.Console;
import java.security.*;
import java.util.Scanner;
public class MDS{
    public static void main(String args[ ]) throws Exception{
        System.out.println("请输入密码");
        Scanner scanner = new Scanner(System.in);
        String pass = scanner.nextLine();
        MessageDigest md5 = MessageDigest.getInstance("MDS");
        md5.update(pass.getBytes());
        byte[] hash = md5.digest();
        pass = "";
        for (int i = 0; i < hash.length; i++) {
            pass += Integer.toHexString(hash[i] & 0xff);
        }
        System.out.println("加密结果为"+pass);
    }
}
